package com.wl4837;

// 具体聚合类（书架）
class BookShelf implements Aggregate<String> {

    public final String[] books;

    private int last = 0;

    public BookShelf(int maxSize) {
        books = new String[maxSize];
    }

    public void appendBook(String book) {
        books[last++] = book;
    }

    public int getLength() {
        return last;
    }

    @Override
    public Iterator<String> createIterator() {
        return new BookShelfIterator(this);
    }

}


